<template>
  <div class="exhibits-content" :style="{ width: props.info.width + 'rem', height: props.info.height + 'rem' }">
    <div class="list">
      <div class="list-content">
        <div
          @contextmenu.stop="emit('onContextMenuChild', $event, index)"
          v-for="(item, index) in props.info.showpieceList"
          :key="index"
          class="exhibits-item"
          :style="{
            backgroundImage: `url(${publicUrls + 'free/style9/exhibitionStandStyle3Bg.webp'})`,
          }"
        >
          <img
            v-lazy="publicUrls + 'free/style9/exhibitionStandStyle2Light.webp'"
            alt=""
            class="item-light"
          />
          <div
            class="img-bg"
            :style="{
              backgroundImage: `url(${
                publicUrls + 'free/style9/exhibitionStandStyle3Bg-2.webp'
              })`,
            }"
          >
            <div class="cover-box">
              <div class="cover" @click="viewImg(item.moduleId, item.id)">
                <img v-lazy="getLinkUrl(item.coverUrl, '?imageView2/3/w/600/format/webp')" alt="" class="exhibit-img" />
                <img
                  v-if="route.meta.loopType"
                  class="flower-btn"
                  v-lazy="publicUrls + 'free/style2/flower.webp'"
                />
              </div>
            </div>
          </div>
          <div
            class="item-content"
            :style="{
              backgroundImage: `url(${
                publicUrls + 'free/style9/exhibitionStandStyle3Bg-1.webp'
              })`,
            }"
          ></div>
          <div class="items-title">
            <p class="items-name">{{ item.name }}</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
export default defineComponent({
  name: 'free9Style3',
});
</script>
<script lang="ts" setup>
import { publicUrls } from '@/utils/minxin';
import { DraggableContainer } from 'vue3-draggable-resizable';
// import FlotMenu from '@/components/flotMenu/OutlineMenu.vue';
import ContextMenu from '@imengyu/vue3-context-menu';
import { getDraggableNumber, getExhibitsHeightRest, getdisabledY } from '@/utils/getRemComputed';
import { ref, reactive, watch, nextTick, defineComponent } from 'vue';
import { exbitMenuShow, exbitListMenuShow } from '@/hooks/menuHooks';
import { useProjectStore } from '@/store';
import { getLinkUrl } from '@/utils/request/upload';
import { useRoute } from 'vue-router';

const emit = defineEmits([
  'emitChildItemDraggable',
  'emitChildItemDraggableStyle',
  'emitShowcaseDraggable',
  'emitShowcaseDraggableStyle',
  'onContextMenuChild',
]);
const store = useProjectStore();
const contextMenuTrigger = ref(); //列表盒子dom
const parentLock = ref(true);
const childShow = ref(true);
const draggableResizable = ref(); //父级拖拽盒子ref
const route = useRoute();
const timer = ref();
const ImgVisible = ref(false);
const ImgUrl = ref('');

const props = defineProps({
  width: {
    type: Number || String,
  },
  height: {
    type: Number || String,
  },
  indexs: {
    type: Number,
  },
  info: {
    type: Object,
  },
  childId: {
    type: Number,
  },
  AuxiliaryId: {
    type: Number,
  },
});

const viewImg = (moduleId: number, e?: number) => {
  store.exhibitsModuleId = moduleId;
  store.exhibitsShowpieceid = e;
  store.exhibitsInfoShow = true;
};

const handleMouseDown = (event) => {
  event.stopPropagation();
};
const preventDefaultDrag = (event) => {
  event.stopPropagation();
};
</script>

<style lang="less" scoped>
.exhibits-content {
  position: relative;
  display: flex;
  z-index: 999;
  // padding: 0 0.1rem !important;
}
.active {
  :deep(.flot-menu) {
    display: flex;
  }
}
:deep(.active) {
  z-index: 999;
}
:deep(.vdr-handle) {
  z-index: 66;
}
.list {
  position: relative;
  display: flex;
  align-items: flex-end;
  width: 100%;
  height: 100%;
}

.list-content {
  display: flex;
  flex: 1;
  height: 676px;
  -webkit-box-reflect: below 0% linear-gradient(transparent, rgba(0, 0, 0, 0.3));
}
.exhibits-item {
  position: relative;
  width: 360px;
  height: 100%;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  margin-right: 20px;
}
.item-light {
  position: absolute;
  top: -90px;
  left: 30px;
  z-index: 20;
  width: 280px;
  height: 589px;
  object-fit: cover;
  pointer-events: none;
}
.item-content {
  position: absolute;
  top: 60px;
  left: 26px;
  z-index: 5;
  width: 280px;
  height: 420px;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  pointer-events: none;
}
.img-bg {
  position: absolute;
  top: 83px;
  left: 35px;
  z-index: 4;
  width: 260px;
  height: 400px;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cover-box {
  width: 254px;
  height: 271px;
}
.cover {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: all 0.3s;
  overflow: hidden;
  .exhibit-img {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: all 0.3s;
  }
}
.cover-box:hover {
  .cover .exhibit-img {
    transform: scale(1.2);
  }
}
.flower-btn {
  width: 50px !important;
  height: 50px !important;
  object-fit: cover !important;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: flower 2s linear infinite;
  @keyframes flower {
    0% {
      opacity: 0;
    }
    40% {
      opacity: 100%;
    }
    60% {
      opacity: 100%;
    }
    100% {
      opacity: 0;
    }
  }
}
.items-title {
  position: absolute;
  bottom: 80px;
  left: 45px;
  width: 240px;
  height: 54px;
  border-bottom: 3px solid #857866;
  border-top: 3px solid #857866;
}
.items-name {
  color: #333;
  text-align: center;
  text-shadow: 0px 1px 0px #ab9e88;
  font-family: 'SourceHanSerifCN';
  font-size: 18px;
  font-style: normal;
  font-weight: 700;
  line-height: 48px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
</style>
